function deepClone(obj) {
    let res = Array.isArray(obj) ? [] : {}
    for (let key in obj) {
        if (obj.hasOwnProperty(key)) {
            if (typeof obj[key] === 'object'&&obj[key]!=null) {
                res[key] = deepClone(obj[key])
            }else{
                res[key] = obj[key]
            }

        }
    }
    return res
}
obj = {
    a: 1,
    b: 2,
    c: {
        d: 3,
    },
    d:[1,[2,3]]

}
let cloneObj = deepClone(obj)
console.log(cloneObj)
cloneObj.c.d = 5
obj.d[1][0] = 5
console.log(cloneObj)
console.log(obj)


